import React from 'react'
import {Result, Button, Icon} from 'antd'

export default ({match: {params}, history}) => {
  const {wrongs, questions} = params
  const backToHome = (<Button type="primary"
                              onClick={() => history.push('/')}>
                        回到首页
                      </Button>)
  if(!wrongs || !questions) {
    return (
      <Result status="404"
              title="不存在的页面"
              extra={backToHome}/>
    )
  }
  return (
    <Result icon={<Icon type="smile" theme="twoTone"/>}
            title={<div>
                     <p>很棒！</p>
                     <p>您一共认识了{questions}位同学。</p>
                     <p>认错{wrongs}次！</p>
                   </div>}
            extra={backToHome}>
    </Result>
  )
}
